package Lee_code;

public class Lee_376 {

    public int wiggleMaxLength(int[] nums) {

        if(nums.length==1)
            return 1;
        int sign =9;

        int count=0;
        for (int i=1; i< nums.length; i=i+1)
        {
            if(nums[i]-nums[i-1]==0) {
                continue;
            }
            else if (nums[i]-nums[i-1]>0)
            {
                if(sign==1)
                {
                    continue;
                }
                sign=1;
                count++;
            }
            else if (nums[i]-nums[i-1]<0)
            {
                if(sign==0)
                    continue;
                sign=0;
                count++;
            }
        }
        return count;
    }
    public static void main(String[] args) {

    }
}
